home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-03 | 5.7 KB | 157 lines | [TEXT/MPS ] |
- // UViewServer.h
- // Copyright © 1984-96 by Apple Computer, Inc. All rights reserved.
-
- #ifndef __UVIEWSERVER__
- #define __UVIEWSERVER__
-
- // MacApp
-
- #ifndef __UGEOMETRY__
- #include "UGeometry.h"
- #endif
-
- #ifndef __UOBJECT__
- #include "UObject.h"
- #endif
-
- // Toolbox
-
-
- //----------------------------------------------------------------------------------------
- // Forward and external class declarations.
- //----------------------------------------------------------------------------------------
-
- class TDocument;
- class TView;
- class TWindow;
-
-
- //----------------------------------------------------------------------------------------
- // arguments of NewPaletteWindow
- const VHSelect kLeftPalette = hSel;
- const VHSelect kTopPalette = vSel;
-
- //----------------------------------------------------------------------------------------
- // template version for MacApp 3.0 views
- const short kMAThreeOhTemplateVersion = 0x0300;
-
- // --------------------------------------------------------------------------------------------------
- // TViewServer is responsible for creating views, either procedurally or from templates.
- //----------------------------------------------------------------------------------------
-
- class TViewServer : public TObject
- {
- MA_DECLARE_CLASS;
-
- public:
-
- //------------------------------------------------------------------------------------
- // Initializer, I<Method> and Free.
- //------------------------------------------------------------------------------------
-
- TViewServer();
- // Empty constructor to satisfy compiler.
-
- void IViewServer();
- // Initializes the TViewServer.
-
- virtual ~TViewServer();
- // Sets the global gViewServer to NULL.
-
- //------------------------------------------------------------------------------------
- // Procedural View Creation
- //------------------------------------------------------------------------------------
-
- virtual TWindow* NewPaletteWindow(ResNumber itsRsrcID,
- Boolean wantHScrollBar,
- Boolean wantVScrollBar,
- TDocument* itsDocument,
- TView* itsMainView,
- TView* itsPaletteView,
- short sizePalette,
- VHSelect whichWay);
- // Used for creating MacDraw-like windows with 1 non-scrolling palette along the
- // left edge (whichWay = h), or a non-scrolling status area at the top of the window
- // (whichWay = v), and a main view that may or may not scroll. Signals Failure if the
- // window could not be created.
-
- virtual TWindow* NewSimpleWindow(ResNumber itsRsrcID,
- Boolean wantHScrollBar,
- Boolean wantVScrollBar,
- TDocument* itsDocument,
- TView* itsView);
- // Used for creating simple windows that contain 1 view and may or may not scroll.
- // Signals Failure if the window could not be created.
-
- virtual void AddSubViewWithScroller(TWindow* aWindow,
- TView* itsView,
- Boolean wantHScrollBar,
- Boolean wantVScrollBar,
- const VPoint& itsLocation);
- // Used to add a view to a window, creating a scroller if needed.
-
- virtual TWindow* NewTWindow(ResNumber itsRsrcID, TDocument* itsDocument);
- // Used for creating a window object. Used within NewPaletteWindow &
- // NewSimpleWindow. SIgnals Failure if the window could not be created.
-
- //------------------------------------------------------------------------------------
- // Creating Views from View Template
- //------------------------------------------------------------------------------------
-
- virtual TWindow* NewTemplateWindow(ResNumber viewRsrcID, TDocument* itsDocument);
- // Used for creating a window using a 'view' template.
-
- virtual TView* DoCreateViews(TDocument* itsDocument,
- TView* parentView,
- ResNumber itsRsrcID,
- const VPoint& subViewOffset);
- // Creates the view hierarchy using ReadViewsFromResource, and calls the root view's
- // AdjustSize and HandlePostCreate methods
-
- virtual TView* ReadViewsFromResource(TDocument* itsDocument,
- TView* parentView,
- ResNumber itsRsrcID,
- const VPoint& subViewOffset);
- // This is the method responsible for creating view hierarchies from resource
- // templates.
-
- // ??? should we have a ReadViewsFromHandle
-
- virtual TView* ReadViewsFrom(TStream* itsStream,
- TView* parentView,
- const VPoint& subviewOffset);
- // Called from ReadViewsFromResource
-
- //------------------------------------------------------------------------------------
- // Writing Views
- //------------------------------------------------------------------------------------
-
- virtual void WriteViewsToResource(TView* view,
- ResNumber itsRsrcID,
- const CStr255& name,
- short resourceAttributes);
- // Calls WriteViewsToHandle to write the view to a handle, and adds the handle to
- // the current resource fork as a 'View' resource with the given resource id, name,
- // and resource attributes.
-
- virtual Handle WriteViewsToHandle(TView* view);
- // Creates a stream and calls WriteViewsTo to write out the view to the stream.
- // Returns the handle containing the streamed views, suitable for saving as a resource.
-
- //------------------------------------------------------------------------------------
- // View Stream Management
- //------------------------------------------------------------------------------------
-
- virtual TStream* DoMakeViewStream(ResNumber itsRsrcID, Handle itsHandle);
- // creates and returns a TStream to be used when reading or writing views
- // if itsHandle != NULL, uses this to create the handle
- // else if itsRsrcID != kNoResourceID, uses this to retrieve the resource
- };
-
-
- // --------------------------------------------------------------------------------------------------
- extern TViewServer* gViewServer; // the globally accessible view server
-
-
- #endif // __UVIEWSERVER__
-